/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.its.talleres.Dao;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.its.talleres.modelo.Taller;

/**
 *
 * @author Yessy
 */
@Stateless
public class TallerDao extends AbstractDao<Taller> implements TallerDaoLocal {
    @PersistenceContext(unitName = "TalleresCulturales-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TallerDao() {
        super(Taller.class);
    }
     public boolean findDuplicity(Taller taller){
       Query q=em.createNamedQuery("Taller.findDuplicity");
       q.setParameter("nombre", taller.getNombre());
        return !q.getResultList().isEmpty();//si esta vacio mandara un no para decirque no hay duplicado y si ya lo hay dira que si
       
         
     }
}
